/* Magnific Popup - v0.9.9 - 2013-11-15
* http://dimsemenov.com/plugins/magnific-popup/
* Copyright (c) 2013 Dmitry Semenov; */
(function (a) {
    var G = "Close", E = "BeforeClose", B = "AfterClose", D = "BeforeAppend", N = "MarkupParse", Q = "Open",
        F = "Change", P = "mfp", H = "." + P, S = "mfp-ready", T = "mfp-removing", R = "mfp-prevent-close";
    var O, M = function () {
    }, q = !!(window.jQuery), v, z = a(window), c, g, u, A, e;
    var s = function (X, W) {
        O.ev.on(P + X + H, W)
    }, k = function (X, W, Z, aa) {
        var Y = document.createElement("div");
        Y.className = "mfp-" + X;
        if (Z) {
            Y.innerHTML = Z
        }
        if (!aa) {
            Y = a(Y);
            if (W) {
                Y.appendTo(W)
            }
        } else {
            if (W) {
                W.appendChild(Y)
            }
        }
        return Y
    }, t = function (X, W) {
        O.ev.triggerHandler(P + X, W);
        if (O.st.callbacks) {
            X = X.charAt(0).toLowerCase() + X.slice(1);
            if (O.st.callbacks[X]) {
                O.st.callbacks[X].apply(O, a.isArray(W) ? W : [W])
            }
        }
    }, j = function (W) {
        if (W !== e || !O.currTemplate.closeBtn) {
            O.currTemplate.closeBtn = a(O.st.closeMarkup.replace("%title%", O.st.tClose));
            e = W
        }
        return O.currTemplate.closeBtn
    }, d = function () {
        if (!a.magnificPopup.instance) {
            O = new M();
            O.init();
            a.magnificPopup.instance = O
        }
    }, V = function () {
        var W = document.createElement("p").style, X = ["ms", "O", "Moz", "Webkit"];
        if (W.transition !== undefined) {
            return true
        }
        while (X.length) {
            if (X.pop() + "Transition" in W) {
                return true
            }
        }
        return false
    };
    M.prototype = {
        constructor: M, init: function () {
            var W = navigator.appVersion;
            O.isIE7 = W.indexOf("MSIE 7.") !== -1;
            O.isIE8 = W.indexOf("MSIE 8.") !== -1;
            O.isLowIE = O.isIE7 || O.isIE8;
            O.isAndroid = (/android/gi).test(W);
            O.isIOS = (/iphone|ipad|ipod/gi).test(W);
            O.supportsTransition = V();
            O.probablyMobile = (O.isAndroid || O.isIOS || /(Opera Mini)|Kindle|webOS|BlackBerry|(Opera Mobi)|(Windows Phone)|IEMobile/i.test(navigator.userAgent));
            c = a(document.body);
            g = a(document);
            O.popupsCache = {}
        }, open: function (X) {
            var Y;
            if (X.isObj === false) {
                O.items = X.items.toArray();
                O.index = 0;
                var aa = X.items, Z;
                for (Y = 0; Y < aa.length; Y++) {
                    Z = aa[Y];
                    if (Z.parsed) {
                        Z = Z.el[0]
                    }
                    if (Z === X.el[0]) {
                        O.index = Y;
                        break
                    }
                }
            } else {
                O.items = a.isArray(X.items) ? X.items : [X.items];
                O.index = X.index || 0
            }
            if (O.isOpen) {
                O.updateItemHTML();
                return
            }
            O.types = [];
            A = "";
            if (X.mainEl && X.mainEl.length) {
                O.ev = X.mainEl.eq(0)
            } else {
                O.ev = g
            }
            if (X.key) {
                if (!O.popupsCache[X.key]) {
                    O.popupsCache[X.key] = {}
                }
                O.currTemplate = O.popupsCache[X.key]
            } else {
                O.currTemplate = {}
            }
            O.st = a.extend(true, {}, a.magnificPopup.defaults, X);
            O.fixedContentPos = O.st.fixedContentPos === "auto" ? !O.probablyMobile : O.st.fixedContentPos;
            if (O.st.modal) {
                O.st.closeOnContentClick = false;
                O.st.closeOnBgClick = false;
                O.st.showCloseBtn = false;
                O.st.enableEscapeKey = false
            }
            if (!O.bgOverlay) {
                O.bgOverlay = k("bg").on("click" + H, function () {
                    O.close()
                });
                O.wrap = k("wrap").attr("tabindex", -1).on("click" + H, function (ag) {
                    if (O._checkIfClose(ag.target)) {
                        O.close()
                    }
                });
                O.container = k("container", O.wrap)
            }
            O.contentContainer = k("content");
            if (O.st.preloader) {
                O.preloader = k("preloader", O.container, O.st.tLoading)
            }
            var ab = a.magnificPopup.modules;
            for (Y = 0; Y < ab.length; Y++) {
                var ac = ab[Y];
                ac = ac.charAt(0).toUpperCase() + ac.slice(1);
                O["init" + ac].call(O)
            }
            t("BeforeOpen");
            if (O.st.showCloseBtn) {
                if (!O.st.closeBtnInside) {
                    O.wrap.append(j())
                } else {
                    s(N, function (ag, ai, aj, ah) {
                        aj.close_replaceWith = j(ah.type)
                    });
                    A += " mfp-close-btn-in"
                }
            }
            if (O.st.alignTop) {
                A += " mfp-align-top"
            }
            if (O.fixedContentPos) {
                O.wrap.css({overflow: O.st.overflowY, overflowX: "hidden", overflowY: O.st.overflowY})
            } else {
                O.wrap.css({top: z.scrollTop(), position: "absolute"})
            }
            if (O.st.fixedBgPos === false || (O.st.fixedBgPos === "auto" && !O.fixedContentPos)) {
                O.bgOverlay.css({height: g.height(), position: "absolute"})
            }
            if (O.st.enableEscapeKey) {
                g.on("keyup" + H, function (ag) {
                    if (ag.keyCode === 27) {
                        O.close()
                    }
                })
            }
            z.on("resize" + H, function () {
                O.updateSize()
            });
            if (!O.st.closeOnContentClick) {
                A += " mfp-auto-cursor"
            }
            if (A) {
                O.wrap.addClass(A)
            }
            var ae = O.wH = z.height();
            var af = {};
            if (O.fixedContentPos) {
                if (O._hasScrollBar(ae)) {
                    var ad = O._getScrollbarSize();
                    if (ad) {
                        af.marginRight = ad
                    }
                }
            }
            if (O.fixedContentPos) {
                if (!O.isIE7) {
                    af.overflow = "hidden"
                } else {
                    a("body, html").css("overflow", "hidden")
                }
            }
            var W = O.st.mainClass;
            if (O.isIE7) {
                W += " mfp-ie7"
            }
            if (W) {
                O._addClassToMFP(W)
            }
            O.updateItemHTML();
            t("BuildControls");
            a("html").css(af);
            O.bgOverlay.add(O.wrap).prependTo(document.body);
            O._lastFocusedEl = document.activeElement;
            setTimeout(function () {
                if (O.content) {
                    O._addClassToMFP(S);
                    O._setFocus()
                } else {
                    O.bgOverlay.addClass(S)
                }
                g.on("focusin" + H, O._onFocusIn)
            }, 16);
            O.isOpen = true;
            O.updateSize(ae);
            t(Q);
            return X
        }, close: function () {
            if (!O.isOpen) {
                return
            }
            t(E);
            O.isOpen = false;
            if (O.st.removalDelay && !O.isLowIE && O.supportsTransition) {
                O._addClassToMFP(T);
                setTimeout(function () {
                    O._close()
                }, O.st.removalDelay)
            } else {
                O._close()
            }
        }, _close: function () {
            t(G);
            var W = T + " " + S + " ";
            O.bgOverlay.detach();
            O.wrap.detach();
            O.container.empty();
            if (O.st.mainClass) {
                W += O.st.mainClass + " "
            }
            O._removeClassFromMFP(W);
            if (O.fixedContentPos) {
                var X = {marginRight: ""};
                if (O.isIE7) {
                    a("body, html").css("overflow", "")
                } else {
                    X.overflow = ""
                }
                a("html").css(X)
            }
            g.off("keyup" + H + " focusin" + H);
            O.ev.off(H);
            O.wrap.attr("class", "mfp-wrap").removeAttr("style");
            O.bgOverlay.attr("class", "mfp-bg");
            O.container.attr("class", "mfp-container");
            if (O.st.showCloseBtn && (!O.st.closeBtnInside || O.currTemplate[O.currItem.type] === true)) {
                if (O.currTemplate.closeBtn) {
                    O.currTemplate.closeBtn.detach()
                }
            }
            if (O._lastFocusedEl) {
                a(O._lastFocusedEl).focus()
            }
            O.currItem = null;
            O.content = null;
            O.currTemplate = null;
            O.prevHeight = 0;
            t(B)
        }, updateSize: function (X) {
            if (O.isIOS) {
                var Y = document.documentElement.clientWidth / window.innerWidth;
                var W = window.innerHeight * Y;
                O.wrap.css("height", W);
                O.wH = W
            } else {
                O.wH = X || z.height()
            }
            if (!O.fixedContentPos) {
                O.wrap.css("height", O.wH)
            }
            t("Resize")
        }, updateItemHTML: function () {
            var W = O.items[O.index];
            O.contentContainer.detach();
            if (O.content) {
                O.content.detach()
            }
            if (!W.parsed) {
                W = O.parseEl(O.index)
            }
            var Z = W.type;
            t("BeforeChange", [O.currItem ? O.currItem.type : "", Z]);
            O.currItem = W;
            if (!O.currTemplate[Z]) {
                var X = O.st[Z] ? O.st[Z].markup : false;
                t("FirstMarkupParse", X);
                if (X) {
                    O.currTemplate[Z] = a(X)
                } else {
                    O.currTemplate[Z] = true
                }
            }
            if (u && u !== W.type) {
                O.container.removeClass("mfp-" + u + "-holder")
            }
            var Y = O["get" + Z.charAt(0).toUpperCase() + Z.slice(1)](W, O.currTemplate[Z]);
            O.appendContent(Y, Z);
            W.preloaded = true;
            t(F, W);
            u = W.type;
            O.container.prepend(O.contentContainer);
            t("AfterChange")
        }, appendContent: function (W, X) {
            O.content = W;
            if (W) {
                if (O.st.showCloseBtn && O.st.closeBtnInside && O.currTemplate[X] === true) {
                    if (!O.content.find(".mfp-close").length) {
                        O.content.append(j())
                    }
                } else {
                    O.content = W
                }
            } else {
                O.content = ""
            }
            t(D);
            O.container.addClass("mfp-" + X + "-holder");
            O.contentContainer.append(O.content)
        }, parseEl: function (X) {
            var Y = O.items[X], Z = Y.type;
            if (Y.tagName) {
                Y = {el: a(Y)}
            } else {
                Y = {data: Y, src: Y.src}
            }
            if (Y.el) {
                var aa = O.types;
                for (var W = 0; W < aa.length; W++) {
                    if (Y.el.hasClass("mfp-" + aa[W])) {
                        Z = aa[W];
                        break
                    }
                }
                Y.src = Y.el.attr("data-mfp-src");
                if (!Y.src) {
                    Y.src = Y.el.attr("href")
                }
            }
            Y.type = Z || O.st.type || "inline";
            Y.index = X;
            Y.parsed = true;
            O.items[X] = Y;
            t("ElementParse", Y);
            return O.items[X]
        }, addGroup: function (X, Z) {
            var W = function (aa) {
                aa.mfpEl = this;
                O._openClick(aa, X, Z)
            };
            if (!Z) {
                Z = {}
            }
            var Y = "click.magnificPopup";
            Z.mainEl = X;
            if (Z.items) {
                Z.isObj = true;
                X.off(Y).on(Y, W)
            } else {
                Z.isObj = false;
                if (Z.delegate) {
                    X.off(Y).on(Y, Z.delegate, W)
                } else {
                    Z.items = X;
                    X.off(Y).on(Y, W)
                }
            }
        }, _openClick: function (X, Y, aa) {
            var Z = aa.midClick !== undefined ? aa.midClick : a.magnificPopup.defaults.midClick;
            if (!Z && (X.which === 2 || X.ctrlKey || X.metaKey)) {
                return
            }
            var W = aa.disableOn !== undefined ? aa.disableOn : a.magnificPopup.defaults.disableOn;
            if (W) {
                if (a.isFunction(W)) {
                    if (!W.call(O)) {
                        return true
                    }
                } else {
                    if (z.width() < W) {
                        return true
                    }
                }
            }
            if (X.type) {
                X.preventDefault();
                if (O.isOpen) {
                    X.stopPropagation()
                }
            }
            aa.el = a(X.mfpEl);
            if (aa.delegate) {
                aa.items = Y.find(aa.delegate)
            }
            O.open(aa)
        }, updateStatus: function (X, Y) {
            if (O.preloader) {
                if (v !== X) {
                    O.container.removeClass("mfp-s-" + v)
                }
                if (!Y && X === "loading") {
                    Y = O.st.tLoading
                }
                var W = {status: X, text: Y};
                t("UpdateStatus", W);
                X = W.status;
                Y = W.text;
                O.preloader.html(Y);
                O.preloader.find("a").on("click", function (Z) {
                    Z.stopImmediatePropagation()
                });
                O.container.addClass("mfp-s-" + X);
                v = X
            }
        }, _checkIfClose: function (Y) {
            if (a(Y).hasClass(R)) {
                return
            }
            var X = O.st.closeOnContentClick;
            var W = O.st.closeOnBgClick;
            if (X && W) {
                return true
            } else {
                if (!O.content || a(Y).hasClass("mfp-close") || (O.preloader && Y === O.preloader[0])) {
                    return true
                }
                if ((Y !== O.content[0] && !a.contains(O.content[0], Y))) {
                    if (W) {
                        if (a.contains(document, Y)) {
                            return true
                        }
                    }
                } else {
                    if (X) {
                        return true
                    }
                }
            }
            return false
        }, _addClassToMFP: function (W) {
            O.bgOverlay.addClass(W);
            O.wrap.addClass(W)
        }, _removeClassFromMFP: function (W) {
            this.bgOverlay.removeClass(W);
            O.wrap.removeClass(W)
        }, _hasScrollBar: function (W) {
            return ((O.isIE7 ? g.height() : document.body.scrollHeight) > (W || z.height()))
        }, _setFocus: function () {
            (O.st.focus ? O.content.find(O.st.focus).eq(0) : O.wrap).focus()
        }, _onFocusIn: function (W) {
            if (W.target !== O.wrap[0] && !a.contains(O.wrap[0], W.target)) {
                O._setFocus();
                return false
            }
        }, _parseMarkup: function (Y, Z, X) {
            var W;
            if (X.data) {
                Z = a.extend(X.data, Z)
            }
            t(N, [Y, Z, X]);
            a.each(Z, function (ac, ad) {
                if (ad === undefined || ad === false) {
                    return true
                }
                W = ac.split("_");
                if (W.length > 1) {
                    var ab = Y.find(H + "-" + W[0]);
                    if (ab.length > 0) {
                        var aa = W[1];
                        if (aa === "replaceWith") {
                            if (ab[0] !== ad[0]) {
                                ab.replaceWith(ad)
                            }
                        } else {
                            if (aa === "img") {
                                if (ab.is("img")) {
                                    ab.attr("src", ad)
                                } else {
                                    ab.replaceWith('<img src="' + ad + '" class="' + ab.attr("class") + '" />')
                                }
                            } else {
                                ab.attr(W[1], ad)
                            }
                        }
                    }
                } else {
                    Y.find(H + "-" + ac).html(ad)
                }
            })
        }, _getScrollbarSize: function () {
            if (O.scrollbarSize === undefined) {
                var W = document.createElement("div");
                W.id = "mfp-sbm";
                W.style.cssText = "width: 99px; height: 99px; overflow: scroll; position: absolute; top: -9999px;";
                document.body.appendChild(W);
                O.scrollbarSize = W.offsetWidth - W.clientWidth;
                document.body.removeChild(W)
            }
            return O.scrollbarSize
        }
    };
    a.magnificPopup = {
        instance: null,
        proto: M.prototype,
        modules: [],
        open: function (X, W) {
            d();
            if (!X) {
                X = {}
            } else {
                X = a.extend(true, {}, X)
            }
            X.isObj = true;
            X.index = W || 0;
            return this.instance.open(X)
        },
        close: function () {
            return a.magnificPopup.instance && a.magnificPopup.instance.close()
        },
        registerModule: function (X, W) {
            if (W.options) {
                a.magnificPopup.defaults[X] = W.options
            }
            a.extend(this.proto, W.proto);
            this.modules.push(X)
        },
        defaults: {
            disableOn: 0,
            key: null,
            midClick: false,
            mainClass: "",
            preloader: true,
            focus: "",
            closeOnContentClick: false,
            closeOnBgClick: true,
            closeBtnInside: true,
            showCloseBtn: true,
            enableEscapeKey: true,
            modal: false,
            alignTop: false,
            removalDelay: 0,
            fixedContentPos: "auto",
            fixedBgPos: "auto",
            overflowY: "auto",
            closeMarkup: '<button title="%title%" type="button" class="mfp-close">&times;</button>',
            tClose: "Close (Esc)",
            tLoading: "Loading..."
        }
    };
    a.fn.magnificPopup = function (aa) {
        d();
        var Z = a(this);
        if (typeof aa === "string") {
            if (aa === "open") {
                var Y, X = q ? Z.data("magnificPopup") : Z[0].magnificPopup, W = parseInt(arguments[1], 10) || 0;
                if (X.items) {
                    Y = X.items[W]
                } else {
                    Y = Z;
                    if (X.delegate) {
                        Y = Y.find(X.delegate)
                    }
                    Y = Y.eq(W)
                }
                O._openClick({mfpEl: Y}, Z, X)
            } else {
                if (O.isOpen) {
                    O[aa].apply(O, Array.prototype.slice.call(arguments, 1))
                }
            }
        } else {
            aa = a.extend(true, {}, aa);
            if (q) {
                Z.data("magnificPopup", aa)
            } else {
                Z[0].magnificPopup = aa
            }
            O.addGroup(Z, aa)
        }
        return Z
    };
    var L = "inline", n, p, r, w = function () {
        if (r) {
            p.after(r.addClass(n)).detach();
            r = null
        }
    };
    a.magnificPopup.registerModule(L, {
        options: {hiddenClass: "hide", markup: "", tNotFound: "Content not found"},
        proto: {
            initInline: function () {
                O.types.push(L);
                s(G + "." + L, function () {
                    w()
                })
            }, getInline: function (Y, aa) {
                w();
                if (Y.src) {
                    var X = O.st.inline, W = a(Y.src);
                    if (W.length) {
                        var Z = W[0].parentNode;
                        if (Z && Z.tagName) {
                            if (!p) {
                                n = X.hiddenClass;
                                p = k(n);
                                n = "mfp-" + n
                            }
                            r = W.after(p).detach().removeClass(n)
                        }
                        O.updateStatus("ready")
                    } else {
                        O.updateStatus("error", X.tNotFound);
                        W = a("<div>")
                    }
                    Y.inlineElement = W;
                    return W
                }
                O.updateStatus("ready");
                O._parseMarkup(aa, {}, Y);
                return aa
            }
        }
    });
    var C = "ajax", b, x = function () {
        if (b) {
            c.removeClass(b)
        }
    }, f = function () {
        x();
        if (O.req) {
            O.req.abort()
        }
    };
    a.magnificPopup.registerModule(C, {
        options: {
            settings: null,
            cursor: "mfp-ajax-cur",
            tError: '<a href="%url%">The content</a> could not be loaded.'
        }, proto: {
            initAjax: function () {
                O.types.push(C);
                b = O.st.ajax.cursor;
                s(G + "." + C, f);
                s("BeforeChange." + C, f)
            }, getAjax: function (W) {
                if (b) {
                    c.addClass(b)
                }
                O.updateStatus("loading");
                var X = a.extend({
                    url: W.src, success: function (Y, ab, Z) {
                        var aa = {data: Y, xhr: Z};
                        t("ParseAjax", aa);
                        O.appendContent(a(aa.data), C);
                        W.finished = true;
                        x();
                        O._setFocus();
                        setTimeout(function () {
                            O.wrap.addClass(S)
                        }, 16);
                        O.updateStatus("ready");
                        t("AjaxContentAdded")
                    }, error: function () {
                        x();
                        W.finished = W.loadError = true;
                        O.updateStatus("error", O.st.ajax.tError.replace("%url%", W.src))
                    }
                }, O.st.ajax.settings);
                O.req = a.ajax(X);
                return ""
            }
        }
    });
    var o, m = function (W) {
        if (W.data && W.data.title !== undefined) {
            return W.data.title
        }
        var X = O.st.image.titleSrc;
        if (X) {
            if (a.isFunction(X)) {
                return X.call(O, W)
            } else {
                if (W.el) {
                    return W.el.attr(X) || ""
                }
            }
        }
        return ""
    };
    a.magnificPopup.registerModule("image", {
        options: {
            markup: '<div class="mfp-figure"><div class="mfp-close"></div><figure><div class="mfp-img"></div><figcaption><div class="mfp-bottom-bar"><div class="mfp-title"></div><div class="mfp-counter"></div></div></figcaption></figure></div>',
            cursor: "mfp-zoom-out-cur",
            titleSrc: "title",
            verticalFit: true,
            tError: '<a href="%url%">The image</a> could not be loaded.'
        }, proto: {
            initImage: function () {
                var W = O.st.image, X = ".image";
                O.types.push("image");
                s(Q + X, function () {
                    if (O.currItem.type === "image" && W.cursor) {
                        c.addClass(W.cursor)
                    }
                });
                s(G + X, function () {
                    if (W.cursor) {
                        c.removeClass(W.cursor)
                    }
                    z.off("resize" + H)
                });
                s("Resize" + X, O.resizeImage);
                if (O.isLowIE) {
                    s("AfterChange", O.resizeImage)
                }
            }, resizeImage: function () {
                var X = O.currItem;
                if (!X || !X.img) {
                    return
                }
                if (O.st.image.verticalFit) {
                    var W = 0;
                    if (O.isLowIE) {
                        W = parseInt(X.img.css("padding-top"), 10) + parseInt(X.img.css("padding-bottom"), 10)
                    }
                    X.img.css("max-height", O.wH - W)
                }
            }, _onImageHasSize: function (W) {
                if (W.img) {
                    W.hasSize = true;
                    if (o) {
                        clearInterval(o)
                    }
                    W.isCheckingImgSize = false;
                    t("ImageHasSize", W);
                    if (W.imgHidden) {
                        if (O.content) {
                            O.content.removeClass("mfp-loading")
                        }
                        W.imgHidden = false
                    }
                }
            }, findImageSize: function (Y) {
                var W = 0, X = Y.img[0], Z = function (aa) {
                    if (o) {
                        clearInterval(o)
                    }
                    o = setInterval(function () {
                        if (X.naturalWidth > 0) {
                            O._onImageHasSize(Y);
                            return
                        }
                        if (W > 200) {
                            clearInterval(o)
                        }
                        W++;
                        if (W === 3) {
                            Z(10)
                        } else {
                            if (W === 40) {
                                Z(50)
                            } else {
                                if (W === 100) {
                                    Z(500)
                                }
                            }
                        }
                    }, aa)
                };
                Z(1)
            }, getImage: function (aa, ad) {
                var X = 0, ab = function () {
                    if (aa) {
                        if (aa.img[0].complete) {
                            aa.img.off(".mfploader");
                            if (aa === O.currItem) {
                                O._onImageHasSize(aa);
                                O.updateStatus("ready")
                            }
                            aa.hasSize = true;
                            aa.loaded = true;
                            t("ImageLoadComplete")
                        } else {
                            X++;
                            if (X < 200) {
                                setTimeout(ab, 100)
                            } else {
                                ac()
                            }
                        }
                    }
                }, ac = function () {
                    if (aa) {
                        aa.img.off(".mfploader");
                        if (aa === O.currItem) {
                            O._onImageHasSize(aa);
                            O.updateStatus("error", Z.tError.replace("%url%", aa.src))
                        }
                        aa.hasSize = true;
                        aa.loaded = true;
                        aa.loadError = true
                    }
                }, Z = O.st.image;
                var W = ad.find(".mfp-img");
                if (W.length) {
                    var Y = document.createElement("img");
                    Y.className = "mfp-img";
                    aa.img = a(Y).on("load.mfploader", ab).on("error.mfploader", ac);
                    Y.src = aa.src;
                    if (W.is("img")) {
                        aa.img = aa.img.clone()
                    }
                    if (aa.img[0].naturalWidth > 0) {
                        aa.hasSize = true
                    }
                }
                O._parseMarkup(ad, {title: m(aa), img_replaceWith: aa.img}, aa);
                O.resizeImage();
                if (aa.hasSize) {
                    if (o) {
                        clearInterval(o)
                    }
                    if (aa.loadError) {
                        ad.addClass("mfp-loading");
                        O.updateStatus("error", Z.tError.replace("%url%", aa.src))
                    } else {
                        ad.removeClass("mfp-loading");
                        O.updateStatus("ready")
                    }
                    return ad
                }
                O.updateStatus("loading");
                aa.loading = true;
                if (!aa.hasSize) {
                    aa.imgHidden = true;
                    ad.addClass("mfp-loading");
                    O.findImageSize(aa)
                }
                return ad
            }
        }
    });
    var J, I = function () {
        if (J === undefined) {
            J = document.createElement("p").style.MozTransform !== undefined
        }
        return J
    };
    a.magnificPopup.registerModule("zoom", {
        options: {
            enabled: false, easing: "ease-in-out", duration: 300, opener: function (W) {
                return W.is("img") ? W : W.find("img")
            }
        }, proto: {
            initZoom: function () {
                var ad = O.st.zoom, aa = ".zoom", Z;
                if (!ad.enabled || !O.supportsTransition) {
                    return
                }
                var X = ad.duration, Y = function (af) {
                    var ag = af.clone().removeAttr("style").removeAttr("class").addClass("mfp-animated-image"),
                        ai = "all " + (ad.duration / 1000) + "s " + ad.easing, ae = {
                            position: "fixed",
                            zIndex: 9999,
                            left: 0,
                            top: 0,
                            "-webkit-backface-visibility": "hidden"
                        }, ah = "transition";
                    ae["-webkit-" + ah] = ae["-moz-" + ah] = ae["-o-" + ah] = ae[ah] = ai;
                    ag.css(ae);
                    return ag
                }, ac = function () {
                    O.content.css("visibility", "visible")
                }, ab, W;
                s("BuildControls" + aa, function () {
                    if (O._allowZoom()) {
                        clearTimeout(ab);
                        O.content.css("visibility", "hidden");
                        Z = O._getItemToZoom();
                        if (!Z) {
                            ac();
                            return
                        }
                        W = Y(Z);
                        W.css(O._getOffset());
                        O.wrap.append(W);
                        ab = setTimeout(function () {
                            W.css(O._getOffset(true));
                            ab = setTimeout(function () {
                                ac();
                                setTimeout(function () {
                                    W.remove();
                                    Z = W = null;
                                    t("ZoomAnimationEnded")
                                }, 16)
                            }, X)
                        }, 16)
                    }
                });
                s(E + aa, function () {
                    if (O._allowZoom()) {
                        clearTimeout(ab);
                        O.st.removalDelay = X;
                        if (!Z) {
                            Z = O._getItemToZoom();
                            if (!Z) {
                                return
                            }
                            W = Y(Z)
                        }
                        W.css(O._getOffset(true));
                        O.wrap.append(W);
                        O.content.css("visibility", "hidden");
                        setTimeout(function () {
                            W.css(O._getOffset())
                        }, 16)
                    }
                });
                s(G + aa, function () {
                    if (O._allowZoom()) {
                        ac();
                        if (W) {
                            W.remove()
                        }
                        Z = null
                    }
                })
            }, _allowZoom: function () {
                return O.currItem.type === "image"
            }, _getItemToZoom: function () {
                if (O.currItem.hasSize) {
                    return O.currItem.img
                } else {
                    return false
                }
            }, _getOffset: function (X) {
                var W;
                if (X) {
                    W = O.currItem.img
                } else {
                    W = O.st.zoom.opener(O.currItem.el || O.currItem)
                }
                var Z = W.offset();
                var ab = parseInt(W.css("padding-top"), 10);
                var aa = parseInt(W.css("padding-bottom"), 10);
                Z.top -= (a(window).scrollTop() - ab);
                var Y = {width: W.width(), height: (q ? W.innerHeight() : W[0].offsetHeight) - aa - ab};
                if (I()) {
                    Y["-moz-transform"] = Y.transform = "translate(" + Z.left + "px," + Z.top + "px)"
                } else {
                    Y.left = Z.left;
                    Y.top = Z.top
                }
                return Y
            }
        }
    });
    var K = "iframe", h = "//about:blank", i = function (X) {
        if (O.currTemplate[K]) {
            var W = O.currTemplate[K].find("iframe");
            if (W.length) {
                if (!X) {
                    W[0].src = h
                }
                if (O.isIE8) {
                    W.css("display", X ? "block" : "none")
                }
            }
        }
    };
    a.magnificPopup.registerModule(K, {
        options: {
            markup: '<div class="mfp-iframe-scaler"><div class="mfp-close"></div><iframe class="mfp-iframe" src="//about:blank" frameborder="0" allowfullscreen></iframe></div>',
            srcAction: "iframe_src",
            patterns: {
                youtube: {index: "youtube.com", id: "v=", src: "//www.youtube.com/embed/%id%?autoplay=1"},
                vimeo: {index: "vimeo.com/", id: "/", src: "//player.vimeo.com/video/%id%?autoplay=1"},
                gmaps: {index: "//maps.google.", src: "%id%&output=embed"}
            }
        }, proto: {
            initIframe: function () {
                O.types.push(K);
                s("BeforeChange", function (W, Y, X) {
                    if (Y !== X) {
                        if (Y === K) {
                            i()
                        } else {
                            if (X === K) {
                                i(true)
                            }
                        }
                    }
                });
                s(G + "." + K, function () {
                    i()
                })
            }, getIframe: function (Z, aa) {
                var X = Z.src;
                var Y = O.st.iframe;
                a.each(Y.patterns, function () {
                    if (X.indexOf(this.index) > -1) {
                        if (this.id) {
                            if (typeof this.id === "string") {
                                X = X.substr(X.lastIndexOf(this.id) + this.id.length, X.length)
                            } else {
                                X = this.id.call(this, X)
                            }
                        }
                        X = this.src.replace("%id%", X);
                        return false
                    }
                });
                var W = {};
                if (Y.srcAction) {
                    W[Y.srcAction] = X
                }
                O._parseMarkup(aa, W, Z);
                O.updateStatus("ready");
                return aa
            }
        }
    });
    var l = function (W) {
        var X = O.items.length;
        if (W > X - 1) {
            return W - X
        } else {
            if (W < 0) {
                return X + W
            }
        }
        return W
    }, y = function (X, W, Y) {
        return X.replace(/%curr%/gi, W + 1).replace(/%total%/gi, Y)
    };
    a.magnificPopup.registerModule("gallery", {
        options: {
            enabled: false,
            arrowMarkup: '<button title="%title%" type="button" class="mfp-arrow mfp-arrow-%dir%"></button>',
            preload: [0, 2],
            navigateByImgClick: true,
            arrows: true,
            tPrev: "Previous (Left arrow key)",
            tNext: "Next (Right arrow key)",
            tCounter: "%curr% of %total%"
        }, proto: {
            initGallery: function () {
                var W = O.st.gallery, X = ".mfp-gallery", Y = Boolean(a.fn.mfpFastClick);
                O.direction = true;
                if (!W || !W.enabled) {
                    return false
                }
                A += " mfp-gallery";
                s(Q + X, function () {
                    if (W.navigateByImgClick) {
                        O.wrap.on("click" + X, ".mfp-img", function () {
                            if (O.items.length > 1) {
                                O.next();
                                return false
                            }
                        })
                    }
                    g.on("keydown" + X, function (Z) {
                        if (Z.keyCode === 37) {
                            O.prev()
                        } else {
                            if (Z.keyCode === 39) {
                                O.next()
                            }
                        }
                    })
                });
                s("UpdateStatus" + X, function (aa, Z) {
                    if (Z.text) {
                        Z.text = y(Z.text, O.currItem.index, O.items.length)
                    }
                });
                s(N + X, function (Z, aa, ad, ab) {
                    var ac = O.items.length;
                    ad.counter = ac > 1 ? y(W.tCounter, ab.index, ac) : ""
                });
                s("BuildControls" + X, function () {
                    if (O.items.length > 1 && W.arrows && !O.arrowLeft) {
                        var ac = W.arrowMarkup,
                            Z = O.arrowLeft = a(ac.replace(/%title%/gi, W.tPrev).replace(/%dir%/gi, "left")).addClass(R),
                            aa = O.arrowRight = a(ac.replace(/%title%/gi, W.tNext).replace(/%dir%/gi, "right")).addClass(R);
                        var ab = Y ? "mfpFastClick" : "click";
                        Z[ab](function () {
                            O.prev()
                        });
                        aa[ab](function () {
                            O.next()
                        });
                        if (O.isIE7) {
                            k("b", Z[0], false, true);
                            k("a", Z[0], false, true);
                            k("b", aa[0], false, true);
                            k("a", aa[0], false, true)
                        }
                        O.container.append(Z.add(aa))
                    }
                });
                s(F + X, function () {
                    if (O._preloadTimeout) {
                        clearTimeout(O._preloadTimeout)
                    }
                    O._preloadTimeout = setTimeout(function () {
                        O.preloadNearbyImages();
                        O._preloadTimeout = null
                    }, 16)
                });
                s(G + X, function () {
                    g.off(X);
                    O.wrap.off("click" + X);
                    if (O.arrowLeft && Y) {
                        O.arrowLeft.add(O.arrowRight).destroyMfpFastClick()
                    }
                    O.arrowRight = O.arrowLeft = null
                })
            }, next: function () {
                O.direction = true;
                O.index = l(O.index + 1);
                O.updateItemHTML()
            }, prev: function () {
                O.direction = false;
                O.index = l(O.index - 1);
                O.updateItemHTML()
            }, goTo: function (W) {
                O.direction = (W >= O.index);
                O.index = W;
                O.updateItemHTML()
            }, preloadNearbyImages: function () {
                var X = O.st.gallery.preload, Z = Math.min(X[0], O.items.length), Y = Math.min(X[1], O.items.length), W;
                for (W = 1; W <= (O.direction ? Y : Z); W++) {
                    O._preloadItem(O.index + W)
                }
                for (W = 1; W <= (O.direction ? Z : Y); W++) {
                    O._preloadItem(O.index - W)
                }
            }, _preloadItem: function (W) {
                W = l(W);
                if (O.items[W].preloaded) {
                    return
                }
                var X = O.items[W];
                if (!X.parsed) {
                    X = O.parseEl(W)
                }
                t("LazyLoad", X);
                if (X.type === "image") {
                    X.img = a('<img class="mfp-img" />').on("load.mfploader", function () {
                        X.hasSize = true
                    }).on("error.mfploader", function () {
                        X.hasSize = true;
                        X.loadError = true;
                        t("LazyLoadError", X)
                    }).attr("src", X.src)
                }
                X.preloaded = true
            }
        }
    });
    var U = "retina";
    a.magnificPopup.registerModule(U, {
        options: {
            replaceSrc: function (W) {
                return W.src.replace(/\.\w+$/, function (X) {
                    return "@2x" + X
                })
            }, ratio: 1
        }, proto: {
            initRetina: function () {
                if (window.devicePixelRatio > 1) {
                    var X = O.st.retina, W = X.ratio;
                    W = !isNaN(W) ? W : W();
                    if (W > 1) {
                        s("ImageHasSize." + U, function (Y, Z) {
                            Z.img.css({"max-width": Z.img[0].naturalWidth / W, width: "100%"})
                        });
                        s("ElementParse." + U, function (Y, Z) {
                            Z.src = X.replaceSrc(Z, W)
                        })
                    }
                }
            }
        }
    });
    (function () {
        var X = 1000, Z = "ontouchstart" in window, aa = function () {
            z.off("touchmove" + Y + " touchend" + Y)
        }, W = "mfpFastClick", Y = "." + W;
        a.fn.mfpFastClick = function (ab) {
            return a(this).each(function () {
                var ac = a(this), ad;
                if (Z) {
                    var aj, ah, ai, ag, af, ae;
                    ac.on("touchstart" + Y, function (ak) {
                        ag = false;
                        ae = 1;
                        af = ak.originalEvent ? ak.originalEvent.touches[0] : ak.touches[0];
                        ah = af.clientX;
                        ai = af.clientY;
                        z.on("touchmove" + Y, function (al) {
                            af = al.originalEvent ? al.originalEvent.touches : al.touches;
                            ae = af.length;
                            af = af[0];
                            if (Math.abs(af.clientX - ah) > 10 || Math.abs(af.clientY - ai) > 10) {
                                ag = true;
                                aa()
                            }
                        }).on("touchend" + Y, function (al) {
                            aa();
                            if (ag || ae > 1) {
                                return
                            }
                            ad = true;
                            al.preventDefault();
                            clearTimeout(aj);
                            aj = setTimeout(function () {
                                ad = false
                            }, X);
                            ab()
                        })
                    })
                }
                ac.on("click" + Y, function () {
                    if (!ad) {
                        ab()
                    }
                })
            })
        };
        a.fn.destroyMfpFastClick = function () {
            a(this).off("touchstart" + Y + " click" + Y);
            if (Z) {
                z.off("touchmove" + Y + " touchend" + Y)
            }
        }
    })();
    d()
})(window.jQuery || window.Zepto);